var t = require;
var e = module;
var o = exports;
Object.defineProperty(o, "__esModule", {value: !0});
var a = (function () {
    function t(t) {
        this.curMask = t;
    }
    t.prototype.clearMask = function () {
        var t = this.curMask;
        cc.isValid(t) && t._graphics && t._graphics.clear();
    };
    t.prototype.getNodeToRectObj = function (t, e) {
        void 0 === e && (e = cc.v2(0, 0));
        var o = t.position;
        return {
            x: o.x - (t.width + e.x) * t.anchorX,
            y: o.y - (t.height + e.y) * t.anchorY,
            w: t.width + e.x,
            h: t.height + e.y
        };
    };
    t.prototype.roundRect = function (t, e, o) {
        void 0 === o && (o = !0);
        var a = this.curMask;
        if (t.length > 0 && cc.isValid(a) && a._graphics) {
            var i = a._graphics;
            o && i.clear();
            t.forEach(function (t) {
                i.roundRect(t.x, t.y, t.w, t.h, e);
            });
            i.fill();
        }
    };
    t.prototype.drawArea = function (t, e) {
        void 0 === e && (e = !0);
        var o = this.curMask;
        if (t.length > 0 && cc.isValid(o) && o._graphics) {
            var a = o._graphics;
            e && a.clear();
            t.forEach(function (t) {
                a.rect(t.x, t.y, t.w, t.h);
            });
            a.fill();
        }
    };
    t.prototype.drawLine = function (t, e, o, a, i) {
        void 0 === e && (e = !0);
        void 0 === o && (o = !1);
        void 0 === a && (a = !1);
        void 0 === i && (i = 2);
        var n = this.curMask;
        if (cc.isValid(n) && n._graphics) {
            var r = n._graphics;
            e && r.clear();
            if (t.length > 1) {
                var s = t.shift();
                r.strokeColor = cc.Color.RED;
                r.lineWidth = i;
                r.moveTo(s.x, s.y);
                t.forEach(function (t) {
                    r.lineTo(t.x, t.y);
                });
                o && r.close();
                r.stroke();
                a && r.fill();
            } else if (1 == t.length) {
                r.circle(t[0].x, t[0].y, i);
                r.fill();
            }
        }
    };
    t.prototype.setInverted = function (t) {
        cc.isValid(this.curMask) && (this.curMask.inverted = t);
    };
    t.prototype.setNodeThrough = function (t, e) {
        var o = e;
        cc.isValid(e) && o._touchListener && (o._touchListener.swallowTouches = t);
    };
    return t;
})();
o.default = a;
